package net.hg.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.Query;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.injector.methods.SelectList;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import net.hg.dao.UserDao;
import net.hg.entity.User;
import net.hg.service.UserService;
import net.hg.utils.Result;
import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public int addUser(User user) {
        user.setStatus(1);
        int i = userDao.insert(user);
        return i;
    }

    @Override
    public int updateUser(User user) {

        return userDao.updateById(user);
    }

    @Override
    public List<User> selectList(QueryWrapper<User> queryWrapper) {
        return userDao.selectList(queryWrapper);
    }

    @Override
    public User login(QueryWrapper<User> queryWrapper) {

        User user1 = userDao.selectOne(queryWrapper);
        return user1;
    }

}
